#!/bin/bash
script_path=$(realpath "${BASH_SOURCE[0]}")
script_dir=$(dirname "$script_path")

# source ${script_dir}/env

# 获取本机IP（示例取第一个IP）
LOCAL_IP=$(hostname -I | awk '{print $1}')

case "$LOCAL_IP" in
    *192.168.1.231) hostnamectl set-hostname k8s-master ;;
    *192.168.1.232) hostnamectl set-hostname k8s-node1 ;;
    *192.168.1.233) hostnamectl set-hostname k8s-node2 ;;
    *)    hostnamectl set-hostname unknown-host ;;
esac